var app = angular.module("myApp", [])
		app.controller("mycontr", function($scope) {
			$scope.Arr = [{
				img: "img/石榴.jpg",
				name: "云南石榴",
				guige: "8个装",
				price: 60,
				num: 1,
				tatal: 60
			}, {
				img: "img/橙子.jpg",
				name: "橙子",
				guige: "12个装",
				price: 21,
				num: 1,
				tatal: 21
			}, {
				img: "img/羊肉.jpg",
				name: "羊肉",
				guige: "1个",
				price: 27,
				num: 1,
				tatal: 27
			}]
			//总价
			$scope.allprice = function() {

				var allprice = 0; //总价必须给个初始值
				for(var i = 0; i < $scope.Arr.length; i++) {
					allprice += $scope.Arr[i].price * $scope.Arr[i].num
				}
				return allprice
			}
			//点击加
			$scope.add = function(index) {
				$scope.Arr[index].num++
			}
			//点击减
			$scope.sub = function(index) {
				if($scope.Arr[index].num > 1) {
					$scope.Arr[index].num--
				}

			}
			//点击删除按钮
			$scope.wrem = function(index) {
				if(confirm("确定删除" + $scope.Arr[index].name + "吗?")) {
					$scope.Arr.splice(index, 1);
				}
			}
			
		})
			//点击quanxuan
			$("#wquanxuan").click(function() {

				$(" :checkbox").prop("checked", true)

			})
				//点击反选
			$("#wfanxuan").click(function() {
			
				$(" :checkbox").prop("checked", function(i, val) {
					return !val

				})

			})